Add 0019-Add-a-printf-attribute-to-movemail.c-to-allow-harden.patch.
authorRob Browning <rlb@defaultvalue.org>
Sun, 29 Jan 2012 19:53:42 +0000 (13:53 -0600)
committerRob Browning <rlb@defaultvalue.org>
Sun, 29 Jan 2012 19:53:45 +0000 (13:53 -0600)
Use varargs in movemail.c error() and add a printf attribute to
support hardened build flags.

1  2 
debian/.git-dpm
debian/patches/0019-Add-a-printf-attribute-to-movemail.c-to-allow-harden.patch
debian/patches/series

diff --cc debian/.git-dpm
index e8c69cc36f0a27c01d5fe548f964031d5a2cfd89,0000000000000000000000000000000000000000..cc2293b9c74e75af7bb4c3392d1b92df8d758d92
mode 100644,000000..100644
--- /dev/null
@@@ -1,8 -1,0 +1,8 @@@
- 47b3d66260508d7529dbd401a3e325fd79cf8e3c
- 47b3d66260508d7529dbd401a3e325fd79cf8e3c
 +# see git-dpm(1) from git-dpm package
++a63b92f0a8f02b186b5c14c2827c0027a0d637b4
++a63b92f0a8f02b186b5c14c2827c0027a0d637b4
 +7aee3de6fd6bca44751754b10a338947fa947b1c
 +7aee3de6fd6bca44751754b10a338947fa947b1c
 +emacs23_23.3+1.orig.tar.bz2
 +80b3822579eddfc120641c5a181eb0b5c7a0667d
 +23065394
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..24c83bed177e7193fadfe7db0f30ee8ddd955fd1
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,139 @@@
++From a63b92f0a8f02b186b5c14c2827c0027a0d637b4 Mon Sep 17 00:00:00 2001
++From: Rob Browning <rlb@defaultvalue.org>
++Date: Sun, 29 Jan 2012 13:42:57 -0600
++Subject: Add a printf attribute to movemail.c to allow hardened build flags.
++
++Emacs should now support the -Wformat -Wformat-security
++-Werror=format-security build flags.
++
++Reported-by: Moritz Muehlenhoff <jmm@debian.org>
++Author: Rob Browning <rlb@defaultvalue.org>
++Date: Sun, 29 Jan 2012 13:51:13 -0600
++Forwarded: bug-gnu-emacs@gnu.org
++Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=655118
++Applied-By: Rob Browning <rlb@defaultvalue.org>
++---
++ lib-src/movemail.c |   34 ++++++++++++++++------------------
++ 1 files changed, 16 insertions(+), 18 deletions(-)
++
++diff --git a/lib-src/movemail.c b/lib-src/movemail.c
++index 58add49..6b2fc20 100644
++--- a/lib-src/movemail.c
+++++ b/lib-src/movemail.c
++@@ -60,6 +60,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
++ #include <sys/file.h>
++ #include <stdio.h>
++ #include <errno.h>
+++#include <stdarg.h>
++ #include <time.h>
++ 
++ #include <getopt.h>
++@@ -152,7 +153,7 @@ extern char *rindex __P((const char *, int));
++ #endif
++ 
++ void fatal ();
++-void error ();
+++void error (const char *template, ...) __attribute__ ((format (printf, 1, 2)));
++ void pfatal_with_name ();
++ void pfatal_and_delete ();
++ char *concat ();
++@@ -610,16 +611,13 @@ fatal (s1, s2, s3)
++    are args for it or null. */
++ 
++ void
++-error (s1, s2, s3)
++-     char *s1, *s2, *s3;
+++error (const char *template, ...)
++ {
+++  va_list ap;
++   fprintf (stderr, "movemail: ");
++-  if (s3)
++-    fprintf (stderr, s1, s2, s3);
++-  else if (s2)
++-    fprintf (stderr, s1, s2);
++-  else
++-    fprintf (stderr, s1);
+++  va_start (ap, template);
+++  vfprintf (stderr, template, ap);
+++  va_end (ap);
++   fprintf (stderr, "\n");
++ }
++ 
++@@ -733,13 +731,13 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
++   server = pop_open (hostname, user, password, POP_NO_GETPASS);
++   if (! server)
++     {
++-      error ("Error connecting to POP server: %s", pop_error, 0);
+++      error ("Error connecting to POP server: %s", pop_error);
++       return EXIT_FAILURE;
++     }
++ 
++   if (pop_stat (server, &nmsgs, &nbytes))
++     {
++-      error ("Error getting message count from POP server: %s", pop_error, 0);
+++      error ("Error getting message count from POP server: %s", pop_error);
++       return EXIT_FAILURE;
++     }
++ 
++@@ -761,7 +759,7 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
++   if ((mbf = fdopen (mbfi, "wb")) == NULL)
++     {
++       pop_close (server);
++-      error ("Error in fdopen: %s", strerror (errno), 0);
+++      error ("Error in fdopen: %s", strerror (errno));
++       close (mbfi);
++       unlink (outfile);
++       return EXIT_FAILURE;
++@@ -785,7 +783,7 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
++       mbx_delimit_begin (mbf);
++       if (pop_retr (server, i, mbf) != OK)
++      {
++-       error ("%s", Errmsg, 0);
+++       error ("%s", Errmsg);
++        close (mbfi);
++        return EXIT_FAILURE;
++      }
++@@ -793,7 +791,7 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
++       fflush (mbf);
++       if (ferror (mbf))
++      {
++-       error ("Error in fflush: %s", strerror (errno), 0);
+++       error ("Error in fflush: %s", strerror (errno));
++        pop_close (server);
++        close (mbfi);
++        return EXIT_FAILURE;
++@@ -809,14 +807,14 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
++ #ifdef BSD_SYSTEM
++   if (fsync (mbfi) < 0)
++     {
++-      error ("Error in fsync: %s", strerror (errno), 0);
+++      error ("Error in fsync: %s", strerror (errno));
++       return EXIT_FAILURE;
++     }
++ #endif
++ 
++   if (close (mbfi) == -1)
++     {
++-      error ("Error in close: %s", strerror (errno), 0);
+++      error ("Error in close: %s", strerror (errno));
++       return EXIT_FAILURE;
++     }
++ 
++@@ -825,7 +823,7 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
++       {
++      if (pop_delete (server, i))
++        {
++-         error ("Error from POP server: %s", pop_error, 0);
+++         error ("Error from POP server: %s", pop_error);
++          pop_close (server);
++          return EXIT_FAILURE;
++        }
++@@ -833,7 +831,7 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
++ 
++   if (pop_quit (server))
++     {
++-      error ("Error from POP server: %s", pop_error, 0);
+++      error ("Error from POP server: %s", pop_error);
++       return EXIT_FAILURE;
++     }
++ 
index e033d48452d28755bb29d0b32161fb979565f112,0000000000000000000000000000000000000000..d88d685edaa001bccb453b3327ff5cc3e48cf993
mode 100644,000000..100644
--- /dev/null
@@@ -1,18 -1,0 +1,19 @@@
 +0001-Prefer-usr-share-info-emacs-23-over-usr-share-info.patch
 +0002-Run-debian-startup-and-set-debian-emacs-flavor.patch
 +0003-Remove-files-that-appear-to-be-incompatible-with-the.patch
 +0004-Adjust-documentation-references-for-Debian.patch
 +0005-Cause-the-build-to-fail-if-liblockfile-isn-t-selecte.patch
 +0006-Avoid-silently-losing-mail-via-fakemail.patch
 +0007-Modify-the-output-of-version-to-indicate-Debian-modi.patch
 +0008-Look-for-NEWS-in-order-to-find-etc-rather-than-GNU.patch
 +0009-Invoke-the-correct-xmlstarlet-executable-on-Debian-s.patch
 +0010-Fix-startup-hang-on-Debian-GNU-kFreeBSD.patch
 +0011-Don-t-clear-FONTCONFIG_LIBS-and-FONTCONFIG_CFLAGS-in.patch
 +0012-Fix-a-tty-related-preprocessor-inclusion-error-affec.patch
 +0013-Expect-0-from-kill-for-zombies-on-GNU-Hurd.patch
 +0014-Add-i386-to-cpp_undefs-in-configure.in-to-fix-i386-m.patch
 +0015-Look-for-crt1.o-in-the-correct-multiarch-location.patch
 +0016-Use-CRT_DIR-to-find-crt-.o-on-ppc64.patch
 +0017-Define-POSIX_SIGNALS-for-GNU-Hurd.patch
 +0018-Don-t-let-CEDET-execute-code-from-an-arbitrary-Proje.patch
++0019-Add-a-printf-attribute-to-movemail.c-to-allow-harden.patch